<!DOCTYPE html>
<html lang="en">
<head>
   <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta name="description" content="">
   <meta name="keywords" content="">
   <meta name="author" content="">

   <title>Kuesioner Online</title>

   <link href="<?php echo base_url('assets/css/bootstrap.min.css') ?>" rel="stylesheet">
   <link href="<?php echo base_url('assets/css/font-awesome.css') ?>" rel="stylesheet">
   <link href="<?php echo base_url('assets/css/custom.css') ?>" rel="stylesheet">
   <link rel="stylesheet" href="<?php echo base_url('/assets/css/alertify.css') ?>">	
	<link rel="stylesheet" href="<?php echo base_url('/assets/css/themes/semantic.css') ?>">

	
	

   <!--script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
   <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
   <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js"></script-->
   <script src="<?php echo base_url('/assets/js/alertify.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/jquery.min.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/parsley.min.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/jquery.media.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/bootstrap.min.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/custom.js') ?>"></script>
   <script>
   var page_load;
	//window.onload = page_load = setTimeout(function() {show_loading('Memuat halaman');}, 400);

	$(window).load(function() {
		clearTimeout(page_load);
		setTimeout(function() {hide_loading();}, 1600);
		//start_check_sess();
		//$('form').submit(function(e) {
			//console.log(e);
			//if($(e.delegateTarget).attr('data-validate') == 'parsley'){			
				//if($(e.delegateTarget).parsley('isValid')){
					show_loading('Memuat halaman', false);
				//}
			//}
			//else {
				//show_loading('Mengirim data', false);
			//}
		//});
		
		//alertify.defaults.glossary.title = 'Arsip Proyek DCKTR';
	});
	
	function start_mytimer() {
	timer = setInterval(function(){myTimer()},1000);		
	}

	function stop_mytimer() {
		clearInterval(timer);
	}

	function myTimer() {
		var titik = $('#mytimer').text();
		if(titik.length < 5) $('#mytimer').text(titik+'.');
		else $('#mytimer').text('.');
	}
	
	function show_loading(loading_text, closable) {
		if($('#ajaxModalLoading').length == 0) {
			if(typeof loading_text == 'undefined') loading_text = 'Loading';
			if(typeof closable == 'undefined') closable = true;
			var $this = $(this)				  
			  , $modal = $('<div class="modal" id="ajaxModalLoading" style="position:absolute;z-index:1500;"><div class="modal-body"><div style="width:600px;margin-left:350px;color:white;text-align:center;"><h1>'+loading_text+'<span id="mytimer">..</span></h1></div></div></div>');
			$('body').append($modal);
			if(!closable) $modal.modal({backdrop: 'static', keyboard: false});
			else $modal.modal();
			start_mytimer();
		}
	}

	function hide_loading() {
		if($('#ajaxModalLoading').length == 1) {
			stop_mytimer();
			$('#ajaxModalLoading').modal('hide');
			$('#ajaxModalLoading').remove();		
		}
	}
	
	function uji_loading() {
		clearTimeout(page_load);
		//setTimeout(function() {}, 160000);
		//start_check_sess();
		//$('form').submit(function(e) {
			//console.log(e);
			//if($(e.delegateTarget).attr('data-validate') == 'parsley'){			
				//if($(e.delegateTarget).parsley('isValid')){
					show_loading('Menguji data', false);
				//}
			//}
			//else {
				//show_loading('Mengirim data', false);
			//}
		//});
		
		//alertify.defaults.glossary.title = 'Arsip Proyek DCKTR';
	}
	
   function post() {
	
		if($('#username').val() == '') {
			alert('Username harus diisi!');
			event.preventDefault();
			return false;
		}
		
		if($('#password').val() == '') {
			alert('Password anda belum diisi!');
			event.preventDefault();
			return false;
		}

	}
	
$(document).ready(function () {
	var url = window.location;
    $('ul.nav a[href="'+ url +'"]').parent().addClass('active');
    $('ul.nav a').filter(function() {
        return this.href == url;
    }).parent().addClass('active');
    
});

<?php
if($this->session->flashdata('alerts')) {
	foreach($this->session->flashdata('alerts') as $key => $alert) {
		if($alert[0] == 'success') echo 'setTimeout(function() {alertify.success("'.$alert[1].'");}, '.($key*250).');'."\n";
		else if($alert[0] == 'error') echo 'setTimeout(function() {alertify.error("'.$alert[1].'");}, '.($key*250).');'."\n";
		else if($alert[0] == 'warning') echo 'setTimeout(function() {alertify.warning("'.$alert[1].'");}, '.($key*250).');'."\n";
		else echo 'setTimeout(function() {alertify.notify("'.$alert[1].'");}, '.($key*250).');'."\n";
	}
}
?>



</script>
 
  <nav class="navbar navbar-default" role="navigation" style="margin-top:-15px">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
	  <?php
		if($this->session->userdata('role') == 1)
		{
		?>
      <a class="navbar-brand" href="<?php echo base_url().'index.php/guest/list_data'?>">STAT</a>
	  <?php
		}
	  ?>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
	<?php 
	 if($this->session->userdata('username') == null)
	 {
	 } else{
		if($this->session->userdata('role') == 1)
		 {
		?>
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		  <ul class="nav navbar-nav">
			<li><a href="<?php echo base_url().'index.php/guest/list_data'?>">Semua Penelitian</a></li>
			<li><a href="<?php echo base_url().'index.php/kuesioner/list_kuesioner'?>">Kuesioner</a></li>
			<li><a href="<?php echo base_url().'index.php/kuesioner/list_data'?>">Data Responden</a></li>
		  </ul>
		  <?php
		  }
	  }
	  ?>
      <!--form class="navbar-form navbar-left" role="search">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form-->
		<?php 
		if($this->session->userdata('username') != null)
		{
		?>
      <ul class="nav navbar-nav navbar-right">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php if($this->session->userdata('username') == null){ /*echo 'Login';*/ } else {echo $this->session->userdata('username');} ?><span class="caret"></span></a>
		  <ul class="dropdown-menu">
			
			<!--form action="<?php //echo base_url().'index.php/otent/auth/'; ?>" method="post" >
				<div style="width: 266px; padding:10px;">
						<input type="text" placeholder="Username" class="form-control" name="username" id="username" style="width:240">
						<input type="password" placeholder="Password" class="form-control" name="password" id="password">						
				</div>
					<button class="btn btn-lg btn-primary btn-block" type="submit" style="width: 115px;margin-left: 10px;" onclick="post()">Sign in</button>
					<a style="margin-left: 12px;" href="<?php //echo base_url().'index.php/akun/registrasi/false';?>">Daftar Akun</a>
			</form-->
				<a style="margin-left: 12px;" href="<?php echo base_url().'index.php/otent/out';?>">Logout</a>
				<!--a style="margin-left: 12px;" href="<?php echo base_url().'index.php/akun/edit_profil/false/'.$this->session->userdata('id_user');?>">Edit Profil</a-->
          </ul>
        </li>
      </ul>
	  <?php 
		} else
			{
			
			}
		?>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
</head>
<body style="background-color:#fff">
		

